import request from "@/util/request/request.ts";
/***    
request.globalRequest(url,请求方式,obj数据,123,true单,true 多array)url, method, data, power, isUpload, isFiles
1===没登录前的请求头
2===携带请求头token
3===刷新token
***/
const apiReturnFac = {};
//  新建返厂单
apiReturnFac.saveReturnFac = (data) =>
  request.globalRequest({
    url: `/mobile/user/repair/save`,
    method: "post",
    data,
    power: 2,
  });
// 获取返厂模块下拉数据
apiReturnFac.getMobileRepairModule = () =>
  request.globalRequest({
    url: `/mobile/select/getMobileRepairModule`,
    method: "GET",
    power: 2,
  });
// 根据返厂模块ID获取返厂模块关联的自定义字段
apiReturnFac.getRepairModuleField = (repairModuleId) =>
  request.globalRequest({
    url: `/mobile/select/getRepairModuleField/${repairModuleId}`,
    method: "get",
    power: 2,
  });
// 获取客户下拉数据
apiReturnFac.getUserDataSelect = (data) =>
  request.globalRequest({
    url: `/mobile/select/getUserDataSelect`,
    method: "post",
    data,
    power: 2,
  });
// 获取返厂详情
apiReturnFac.getUserRepairDetail = (id) =>
  request.globalRequest({
    url: `/mobile/user/repair/getUserRepairDetail/${id}`,
    method: "get",
    power: 2,
  });
// 获取返厂列表
apiReturnFac.getUserRepairList = (data) =>
  request.globalRequest({
    url: `/mobile/user/repair/getUserRepairList`,
    data,
    method: "post",
    power: 2,
  });
// 获取返厂详情的商品信息
apiReturnFac.getUserRepairGoodsDetail = (id) =>
  request.globalRequest({
    url: `/mobile/user/repair/getUserRepairGoodsDetail/${id}`,
    method: "get",
    power: 2,
  });
// 获取返厂列表的状态数量
apiReturnFac.getUserRepairListSatusCount = () =>
  request.globalRequest({
    url: `/mobile/user/repair/getUserRepairListSatusCount`,
    method: "get",
    power: 2,
  });
// 获取服务进度
apiReturnFac.getRepairLog = (data, id) =>
  request.globalRequest({
    url: `/mobile/user/repair/getRepairLog/${id}`,
    data,
    method: "post",
    power: 2,
  });
// 获取返厂自定义字段
apiReturnFac.getUserRepairField = (id) =>
  request.globalRequest({
    url: `/mobile/user/repair/getUserRepairField/${id}`,
    method: "get",
    power: 2,
  });

// ----------- 返厂相关 -----------
// 根据返厂模块ID获取默认返厂地址
apiReturnFac.getRepairModuleCallbackFactoryAddr = (id) =>
  request.globalRequest({
    url: `/mobile/select/getRepairModuleCallbackFactoryAddr/${id}`,
    method: "get",
    power: 2,
  });
// 获取物流下拉列表
apiReturnFac.getLogisticsSelectList = (data) =>
  request.globalRequest({
    url: `/mobile/select/getLogisticsSelectList`,
    method: "post",
    data,
    power: 2,
  });
// 保存填写返厂物流
apiReturnFac.saveCallbackFactoryLogistics = (id, data) =>
  request.globalRequest({
    url: `/mobile/user/repair/saveCallbackFactoryLogistics/${id}`,
    method: "post",
    data,
    power: 2,
  });

/**
 * 确定签收
 * @param {String} id - 返厂id
 */
apiReturnFac.confirmSignFor = (id) => request.globalRequest({
	url: `/mobile/user/repair/saveSureSign/${id}`,
	method: 'post',
	power: 2
})

export default apiReturnFac;
